using System.Linq;
using System.Configuration;
using System.Runtime.Serialization;

namespace SplendidCRM.WCF.Data
{
    partial class SplendidDataContext
    {
        //private static SqlDatabase _database;

        private static SplendidDataContext _sdc;

        public SplendidDataContext()
            : this(ConfigurationManager.AppSettings["SplendidSQLServer"])
        {

        }

        /// <summary>
        /// Resets the data context.
        /// </summary>
        public static void ResetDataContext()
        {
            SplendidDataContext._sdc = new SplendidDataContext();
        }

        /// <summary>
        /// Gets a copy of the data context.
        /// </summary>
        /// <value>The data context.</value>
        public static SplendidDataContext DataContext
        {
            get
            {
                if (SplendidDataContext._sdc == null)
                    SplendidDataContext.ResetDataContext();
                return SplendidDataContext._sdc;
            }
        }

        /// <summary>
        /// Gets the database object for performing queries against.
        /// </summary>
        /// <value>The database.</value>
        //public static SqlDatabase Database
        //{
        //    get
        //    {
        //        if (SplendidDataContext._database == null)
        //        {
        //            _database = new SqlDatabase(Properties.Settings.Default.SplendidCRMConnectionString);
        //        }
        //        return SplendidDataContext._database;
        //    }
        //}
    }

    partial class Task
    {
        private string clientReference;

        [DataMember]
        public string ClientReference
        {
            get { return clientReference; }
            set { clientReference = value; }
        }
    }

    partial class ProjectTask
    {
        private string clientReference;

        [DataMember]
        public string ClientReference
        {
            get { return clientReference; }
            set { clientReference = value; }
        }
    }
}